import type { IQuery, IResponse, TableResponse } from '@/api/config/types';
import axios from 'axios';

export interface DictType {
  dictId: string;
  dictName: string;
  dictType: string;
  dictValue: string;
}

const prefix = '/system/dict/type';

export const listDictType = (query: IQuery) =>
  axios.get<TableResponse<DictType>>(`${prefix}/list`, { params: query });

export const addDictType = (data: DictType) => axios.post<IResponse>(prefix, data);

export const updateDictType = (data: DictType) => axios.put<IResponse>(prefix, data);

export const delDictType = (id: string) => axios.delete<IResponse>(`${prefix}/${id}`);

export const getDictType = (id: string | number) =>
  axios.get<IResponse<DictType>>(`${prefix}/${id}`);
